<template>
    <div>
        <div class="DuiQi">
            <p class="DuiQi_p1">￥</p>
            <input  v-model="num" ref="myInput" class="input1"  />
        </div>
        
        <div class="shuzi">
          
                <button class="but1" @click='add1()'>1</button>
                <button class="but1" @click='add2()'>2</button>
                <button class="but1" @click='add3()'>3</button>
            
            
                <button class="but1" @click='add4()'>4</button>
                <button class="but1" @click='add5()'>5</button>
                <button class="but1" @click='add6()'>6</button>
           
            
           
                <button class="but1" @click='add7()'>7</button>
                <button class="but1" @click='add8()'>8</button>
                <button class="but1" @click='add9()'>9</button>
          
           
                <button class="but1" @click='add10()'>·</button>
                <button class="but1" @click='add11()'>0</button>
                <button class="but1" @click="clear()">X</button>
              
            
            
        </div>
        <el-button class="but_zhifu" :disabled="flag1" type="primary" @click="zhifu()">现在支付</el-button>

        <!-- 结算成功页面 -->
        <el-dialog
            v-model="dialogVisible_JieSuan"
            :show-close="false"
            title=""
            style="
                width: 600px;
                height: 600px;
                background-color: #fff;
                border-radius: 25px;
                position: absolute;
                left: 50%;
                top: 50%;
                transform: translate(-50%, -50%);">
            
            <template #footer>
              
                <div class="Y_yuan">
                    <div class="N_yuan">    
                        <svg class="duigou" aria-hidden="true">
                            <use xlink:href="#icon-duigoux-copy"></use>
                        </svg>
                    </div>
                </div>
                <div class="JieSuan_div1">支付成功</div>
                <div class="JieSuan_div2">感谢您的付款！您们可以在订单页面查看订单状态</div>
                <div class="JieSuan_but"> 
                    <button class="JieSuan_but1">打印账单</button>
                    <button class="JieSuan_but2">完成支付</button>
                </div>
            </template>
        </el-dialog>
    </div>
</template>
<script setup name="" lang="ts">
   import {ref,onMounted,nextTick } from 'vue';
   import { watch,watchEffect } from 'vue';
   const num=ref('')
   const isVisible = ref(true);
   const flag1=ref(true)
   const myInput = ref(null);
   const dialogVisible_JieSuan= ref(false)

    watchEffect(()=>{
        if(num.value.length>0){
            isVisible.value=true
            flag1.value=false
        }else{
            isVisible.value=false
            flag1.value=true
        }
    })

    onMounted(() => {
    nextTick(() => {
        myInput.value.focus();

    });
    });

    function zhifu(){
        dialogVisible_JieSuan.value=true
    }



  

               
   function add1(){
    num.value=num.value+'1'
  
   }
   function add2(){
    num.value=num.value+'2'
  
   }
   function add3(){
    num.value=num.value+'3'
  
   }
   function add4(){
    num.value=num.value+'4'
  
   }
   function add5(){
    num.value=num.value+'5'
  
   }
   function add6(){
    num.value=num.value+'6'
  
   }
   function add7(){
       
   }
   function add8(){
    num.value=num.value+'8'
  
   }
   function add9(){
    num.value=num.value+'9'
  
   }
   function add10(){
    num.value=num.value+'.'
  
   }
   function add11(){
    num.value=num.value+'0'
  
   }

   function clear(){
    num.value=num.value.slice(0,num.value.length-1)
   }



</script>

<style scoped lang="less">
    //两端对齐
    .DuiQi{
        width: 400px;
        height: 70px;
        display: flex;
        justify-content: space-between;
        // border: 1px solid red;
        align-self: center;
        margin-top: 50px;
        margin-left: 140px; 
        line-height: 70px;
        font-size: 60px;
    }
    .DuiQi_p1{
        width: 60px;
        height: 70px;
        // border: 1px solid blue;
    }
    //结算金额
    .input1{
        width: 340px;
        height: 70px;
        // margin-top: 80px;
        // margin-left: 115px; 
        margin-bottom: 20px;
        font-size: 50px;
        font-family:Verdana, Geneva, Tahoma, sans-serif;
        border: 1px solid #fff;
    }
    .shuzi{
        // margin-left: 20px;
        margin-top: 30px;
        // border: 1px solid #000;
        display: flex;
        justify-content: space-between;
        flex-wrap: wrap;
        
            .but1{
                width: 145px;
                height: 100px;
                font-size:40px;
                background-color: #fff;
                border: 1px solid #fff;
                margin-top: 15px;
                cursor: pointer;
                font-weight: bold;
                border-radius: 10px;
               
            }

    }
    .but_zhifu{
        // background-color: hsl(208, 99%, 44%);
        color: #fff;
        width: 460px;
        height: 70px;
        line-height: 35px;
        margin-right: 50px;
        margin-top: 30px;
        font-size: 30px;
        border-radius: 10px;
        font-family:Verdana, Geneva, Tahoma, sans-serif
    }
    input:focus{
        //默认移除外部轮廓
        outline: none;;
        border: 1px solid white;
        box-shadow: 0 0 3px rgba(0, 0, 0, 0.2);
    }

    //结算完成弹框开始
    .Y_yuan{
    width: 200px;
    height: 200px;
    border: 1px solid #DCEEFE;
    background-color: #DCEEFE;
    border-radius: 50%;
    position: relative;  
    margin-left: 210px     
    // display: flex;
    // justify-content: center;
    // align-items: center;

    }
    .N_yuan{
        width: 100px;
        height: 100px;
        border: 1px solid #025CCA;
        background-color: #025CCA;
        border-radius: 50%;
        position: absolute;
        top:50%;
        left: 50%;
        transform: translate(-50%,-50%);        
    }
    
    .duigou{
        width: 50px;
        height: 50px;
        // border: 1px solid #025CCA;
        border-radius: 50%;
        position: absolute;
        top:50%;
        left: 50%;
        transform: translate(-50%,-50%);
        
    }
    .JieSuan_div1{

        width: 130px;
        height: 50px;
        // border: 1px solid red;
        display: flex;
        justify-content: space-between;
        font-size: 30px;
        font-weight: bold;
        margin-top: 30px;
        margin-left: 250px;     
    }
    .JieSuan_div2{
        width: 100%;
        height: 50px;
        // border: 1px solid red;
        display: flex;
        justify-content: space-between;
        font-size: 16px;
        margin-left: 140px;
        margin-top: 30px;
    
    }
    .JieSuan_but{
        // border: 1px solid red;
        width: 440px;
        height: 50px;
        margin-left: 90px;
        display: flex;
        justify-content: space-between;
    }
    .JieSuan_but1{ 
        width: 200px;
        height: 50px;
        background-color:#F5F5F5; 
        border: 1px solid #F5F5F5;
        color: #000;
        border-radius: 10px;
        cursor: pointer;
        
    }
    .JieSuan_but2{       
        width: 200px;
        height: 50px;
        background-color:#025CCA; 
        color:#fff;
        border-radius: 10px;
        border: 1px solid #F5F5F5;
        cursor: pointer;
    }
        //结算完成弹框结束
       

    

</style>